Skip to content

Conversation

silvekkk
Copy link
Contributor

@silvekkk silvekkk commented Oct 6, 2025

When developing with forge test --watch, running all tests on every file change can be slow . Adds a --rerun-failed flag that automatically reruns only previously failed tests when files change, falling back to normal watch behavior once failures are resolved.

The flag use the existing test failure tracking mechanism (cache/test-failures file) when tests fail. When enabled, watch mode checks if this file exists and automatically adds --rerun to the command, otherwise it proceeds with the standard file-based test filtering.

For example, in a project with 80 tests where 3 are failing, this reduces iteration time from ~2 minutes to ~6 seconds per change, making watch mode practical for TDD workflows where you're iterating on fixing specific test failures.

Usage: forge test --watch --rerun-failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

1 participant